STEP 6: Now let's call the function so the commands inside will run.

You can call a function anywhere in your program AFTER it is defined. It must be OUTSIDE the function.

  • Go to and drag a Wait INSIDE the function, after the other commands.
  • Go to and drag out Function Call.
  • Change my_function() to bridge_scene(). Click Run to see your function on the stage.

To navigate the page using the TAB key, first press ESC to exit the code editor.

sprite = codesters.Sprite("knight1", -175, -150) sprite.set_speed(2) def park_scene(): stage.set_background("park") sprite.say("I should hurry to the castle!") sprite.move_forward(550) park_scene() def bridge_scene(): stage.set_background("drawbridge") sprite.go_to(-175, -150) sprite.say("I made it!")
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)